import amesu from "../../model/bot/amesu";
import { MsgAction, Tpl_gifts_default } from "../../shared/master/MsgAction";
import { style_default } from "../../style/default";

export default async function(data:MsgAction){
    let d = data.data as Tpl_gifts_default;
    let s = new style_default();
    s.setTitle(d.title,'✨')
    for (let i = 0; i < d.items.length; i++) {
        const element = d.items[i];
        if(element.num == 1){
            s.addLine(`${element.name}`);
        }else if(element.num > 0){
            s.addLine(`${element.name}+${element.num}`);
        }else if(element.num < 0){
            s.addLine(`${element.name}`);
        }
    }
    await s.addOne();
    amesu.sendText(data.tolocation,s.end());
}